package com.yunyi.web.controller.statisticalform;

import com.yunyi.common.core.domain.AjaxResult;
import com.yunyi.common.core.domain.entity.SysDictData;
import com.yunyi.system.domain.ConsultationReport;
import com.yunyi.system.domain.ConsultationStatisticsRequest;
import com.yunyi.system.service.EmrCaseLogService;
import com.yunyi.system.service.ISysDictDataService;
import com.yunyi.system.service.SysDoctorinfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "统计报表")
@RequestMapping("sf/cs")
@RestController
public class ConsultationStatisticsController {

    @Resource
    private SysDoctorinfoService doctorinfoService;

    @Resource
    private EmrCaseLogService emrCaseLogService;

    @Resource
    private ISysDictDataService sysDictDataService;


    @ApiOperation(value = "会诊统计")
    @PostMapping("cs")
    public AjaxResult consultationStatistics(@RequestBody ConsultationStatisticsRequest request){
        return doctorinfoService.consultationStatistics(request);
    }

    @PostMapping("cr")
    public AjaxResult consultationReport(@RequestBody ConsultationReport report) {
        System.out.println(report);
        return emrCaseLogService.consultationReport(report);
    }

    @GetMapping("getConsultationStatus")
    public AjaxResult getConsultationStatus(){
        List<SysDictData> consultationStatus = sysDictDataService.getConsultationStatus();
        return consultationStatus == null ? AjaxResult.error("暂无数据") : AjaxResult.success("获取会诊状态",consultationStatus);
    }
}
